<template>
  <div class="content">
    <div style="margin-top: 5rem;">
      <h3>{{ $route.meta.title }}</h3>
      <el-divider />
    </div>
    <div>
      <div class="box">
        <!-- 111111111111 -->
        <div>
          <div class="boxtitle">
            C1达成条件
          </div>
          <div class="boxcontent">
            直推
            <div class="int">
              <el-input v-model="params.onePerson" type="text" />
            </div>
            人， 伞下
            <div class="int">
              <el-input v-model="params.oneNode" type="text" />
            </div>
            节点
          </div>
        </div>
        <!-- 111111111111 -->
        <div>
          <div class="boxtitle">
            C2达成条件
          </div>
          <div class="boxcontent">
            直推
            <div class="int">
              <el-input v-model="params.twoPerson" type="text" />
            </div>
            人， 伞下
            <div class="int">
              <el-input v-model="params.twoNode" type="text" />
            </div>
            节点
          </div>
        </div>
        <!-- 111111111111 -->
        <div>
          <div class="boxtitle">
            C3达成条件
          </div>
          <div class="boxcontent">
            直推
            <div class="int">
              <el-input v-model="params.threePerson" type="text" />
            </div>
            人， 伞下
            <div class="int">
              <el-input v-model="params.threeNode" type="text" />
            </div>
            节点
          </div>
        </div>
        <!-- 111111111111 -->
        <div>
          <div class="boxtitle">
            C4达成条件
          </div>
          <div class="boxcontent">
            直推
            <div class="int">
              <el-input v-model="params.fourPerson" type="text" />
            </div>
            人， 伞下
            <div class="int">
              <el-input v-model="params.fourNode" type="text" />
            </div>
            节点
          </div>
        </div>
        <div class="boxcontent">
          <div class="int" style="text-align: right;width:80%;">
            <el-button type="primary" @click="determine">确定保存</el-button>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { getTramLevelConf, tramLevelConf } from '@/api/jackbo/platform.js'
export default {
  name: 'Teamlevel',
  data() {
    return {
      params: {
        onePerson: '',
        oneNode: '',
        twoPerson: '',
        twoNode: '',
        threePerson: '',
        threeNode: '',
        fourPerson: '',
        fourNode: ''

      }

    }
  },
  mounted() {
    this.getlist()
  },
  methods: {
    async getlist() {
      const res = await getTramLevelConf()
      if (res.code == 0) {
        for (const key in res.data) {
          res.data[key] = parseInt(res.data[key])
        }
        console.log(res.data)
        this.params = res.data
      }
    },
    async determine() {
      const params = {
        ...this.params
      }
      const res = await tramLevelConf(params)
      // console.log(res)
      if (res.code == 0) {
        // alert(1)
        this.getlist()
      }

      // console.log(obj)
    }
  }
}
</script>
<style scoped>
.box {
  /* height:8rem; */
  padding: 1rem;
  border: 1px solid #dddddd;
  border-radius: 0.5rem;
  width: 98%;
  margin: 0 auto;
  /* border; */
  margin-top: 2rem;
}
.boxtitle {
  font-size: 1.25rem;
  height: 3rem;
  line-height: 3rem;
}
.int {
  display: inline-block;
  width: 10rem;
}
.boxcontent {
  font-size: 1.25rem;
  height: 3rem;
  line-height: 3rem;
}
</style>
